package com.android.djlmapp.tools.login;

import android.content.Context;
import android.telephony.TelephonyManager;

/**
 * Created by wa on 2017/2/9.
 */

public class PhoneUtils {
    public Context context;

    public PhoneUtils(Context context) {
        this.context = context;
    }

    public static String getImsi(Context context){
        if (context == null) {
            throw new RuntimeException("not init the context!");
        }
        String imsi=null;
        TelephonyManager mTm = (TelephonyManager) context
                .getSystemService(Context.TELEPHONY_SERVICE);
        imsi = mTm.getSubscriberId();
        if (imsi == null || imsi.length() == 0) {
            imsi = mTm.getDeviceId();
            if (imsi == null || imsi.length() == 0) {
//                imsi = getLocalMacAddressFromBusybox();
            }
        }
        return imsi;
    }


}
